package com.linfeng.business.admin.executor.admin.cmd;

import cn.hutool.jwt.JWTUtil;
import com.linfeng.business.admin.domain.entity.SysAdminEntity;
import com.linfeng.business.admin.dto.event.admin.cmd.AdminCreateCmd;
import com.linfeng.business.admin.executor.admin.AdminBaseExe;
import com.linfeng.component.common.tools.PasswordTools;
import com.linfeng.component.mybatisplus.executor.cmd.CreateCmdExe;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class AdminCreateCmdExe extends CreateCmdExe<AdminCreateCmd,SysAdminEntity> {

    @Value(value = "${admin_user.default_password:123456}")
    private String defaultPassword;

    @Override
    public void handlerCmd(AdminCreateCmd cmd) {

        //  TODO 初始化创建人
        cmd.setCreatorId(1L);

        // 默认密码123456
        cmd.setPassword(PasswordTools.encode(defaultPassword));
    }
}
